# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Maintainer: Daniel Bermond <dbermond@archlinux.org>
# Contributor: Luis Garcia <luigi311.lg@gmail.com>

pkgname=svt-hevc
pkgver=1.5.1
pkgrel=2
pkgdesc='Scalable Video Technology HEVC encoder'
arch=(loong64 x86_64)
url=https://github.com/OpenVisualCloud/SVT-HEVC
license=(BSD)
makedepends=(
  cmake
  git
  nasm
  ninja
)
_tag=b65eba07e6dee37407631cc441561960838b0333
source=(git+https://github.com/OpenVisualCloud/SVT-HEVC.git#tag=${_tag})
md5sums=(SKIP)

pkgver() {
  cd SVT-HEVC
  git describe --tags | sed 's/^v//'
}

prepare() {
  sed '/CMAKE_BUILD_TYPE Release/d' -i SVT-HEVC/CMakeLists.txt
}

build() {
  export LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
  cmake -S SVT-HEVC -B build -G Ninja \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    -DNATIVE=OFF
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
  install -Dm 644 SVT-HEVC/LICENSE.md -t "${pkgdir}"/usr/share/licenses/svt-hevc/
}

# vim: ts=2 sw=2 et:
